package org.ainlolcat.ctp.model.data;

/**
 * Created by IntelliJ IDEA.
 * User: ain
 * Date: 03.09.12
 * Time: 13:18
 * To change this template use File | Settings | File Templates.
 */
public class Column {
    static int TYPE_DOUBLE = 1;
    static int TYPE_INTEGER = 2;
    static int TYPE_STRING = 3;
    static int TYPE_REFERENCE = 4;
    static int TYPE_OBJECT = -1;

    Entity entity;
    int column;
    String name;
    int type;

    public Column(Entity entity, int column, String name) {
        this.entity = entity;
        this.column = column;
        this.name = name;
    }

    public Column(Entity entity, int column, String name, int type) {
        this.entity = entity;
        this.column = column;
        this.name = name;
        this.type = type;
    }

    public Object getData(int row){
        return entity.getData(column, row);
    }

    public int getRowCount(){
        return  entity.rowCount();
    }
    
    public Entity getEntity() {
        return entity;
    }

    public void setEntity(Entity entity) {
        this.entity = entity;
    }

    public int getColumn() {
        return column;
    }

    public void setColumn(int column) {
        this.column = column;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }
    
    public Column clone(){
        return new Column(entity, column, name, type);
    }
}
